//
//  PromtViewController.m
//  NaRiLSVMT
//
//  Created by zhangmeng on 14-8-29.
//  Copyright (c) 2014年 helloyouth.org. All rights reserved.
//

#import "PromtViewController.h"
#import "NRLSVMForScreenViewController.h"
#import "PromtViewController+Request.h"
@interface PromtViewController ()

@end

@implementation PromtViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.detaillab = [[UILabel alloc] initWithFrame:Frame(0, 0, 577, 265)];
    [self.detaillab setNumberOfLines:0];
    self.detaillab.font = Font(19.0);
    self.detaillab.backgroundColor = ClearColor;
    self.detaillab.textColor = [UIColor whiteColor];
    [self.scrollView addSubview:self.detaillab];
   // self.detaillab.backgroundColor = [UIColor redColor];
//    NSString *tmpstr = @"PAD通过NETTY通道发送切屏，标注等命令给后台，由后台转发给播放器PAD通过NETTY通道发送切屏，标注等命令给后台，由后台转发给播放器PAD通过NETTY通道发送切屏，标注等命令给后台，由后台转发给播放器PAD通过NETTY通道发送切屏，标注等命令给后台，由后台转发给播放器PAD通过NETTY通道发送切屏，标注等命令给后台，由后台转发给播放器PAD通过NETTY通道发送切屏，标注等命令给后台，由后台转发给播放器PAD通过NETTY通道发送切屏，标注等命令给后台，由后台转发给播放器PAD通过NETTY通道发送切屏，标注等命令给后台，由";
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
    self.detaillab = nil;
   self.templeted = nil;
   self.screenId = nil;
   self.demData = nil;
}
-(void)viewDidUnload
{
    [super viewDidUnload];
    self.detaillab = nil;
    self.templeted = nil;
    self.screenId = nil;
    self.demData = nil;
}
-(void)showViewblock:(NSString *)templeted Name:(NSString *)name
{
    self.templeted = templeted;
    self.imagename.text = name;
    [self getThumbDetail];
}
-(void)setDetailLabdata:(NSString *)tmpstr
{
    if(![Common isEmptyString:tmpstr]){
    CGSize s = [tmpstr sizeWithFont:self.detaillab.font
                  constrainedToSize:Size(self.detaillab.frame.Width, MAXFLOAT)
                      lineBreakMode:NSLineBreakByWordWrapping];
    
    float tmpf = (s.height/25-1)*35.0+s.height;
    if(tmpf > 265){
        CGRect r = self.detaillab.frame;
        r.size.height = tmpf;
        self.detaillab.frame = r;
        self.scrollView.contentSize = CGSizeMake(0,tmpf+45.0);
    }
    //self.scrollView.contentSize = CGSizeMake(577,600);
    NSMutableAttributedString *attri = [[NSMutableAttributedString alloc] initWithString:tmpstr];
    NSMutableParagraphStyle *parstyle = [[NSMutableParagraphStyle alloc] init];
    [parstyle setLineSpacing:35.0];
    [attri addAttribute:NSParagraphStyleAttributeName value:parstyle range:NSMakeRange(0,[tmpstr length])];
    self.detaillab.attributedText = attri;
    [self.detaillab sizeToFit];
    }
    else{
    self.detaillab.text = @"";
    }
}
-(IBAction)closeBtnclick:(id)sender
{
    [self.view removeFromSuperview];
    if([self.delegate respondsToSelector:@selector(promtblock)]){
        [self.delegate promtblock];
    }
}
@end
